#include "fxcc/core/graph/common/TextureMaps.h"

bool fxcc::graph::common::TextureMaps::OnLoad()
{
	for (auto& it : m_Texture2Ds)
	{
		it.second.OnLoad();
	}

	for (auto& it : m_Texture2DArrays)
	{
		it.second.OnLoad();
	}
	for (auto& it : m_TextureCubes)
	{
		it.second.OnLoad();
	}
	for (auto& it : m_TextureCubeArrays)
	{
		it.second.OnLoad();
	}
	for (auto& it : m_Texture3Ds)
	{
		it.second.OnLoad();
	}
	return true;
}

bool fxcc::graph::common::TextureMaps::SetTexture2D(const std::string& key, const std::string& realPath)
{
	auto& index = m_Texture2Ds[key].m_Index;
	index.m_TargetFilePath = realPath;
	return m_Texture2Ds[key].OnLoad();
}

bool fxcc::graph::common::TextureMaps::SetTexture2DArray(const std::string& key, const std::string& realPath)
{
	auto& index = m_Texture2DArrays[key].m_Index;
	index.m_TargetFilePath = realPath;
	return m_Texture2DArrays[key].OnLoad();
}

bool fxcc::graph::common::TextureMaps::SetTextureCube(const std::string& key, const std::string& realPath)
{
	auto& index = m_TextureCubes[key].m_Index;
	index.m_TargetFilePath = realPath;
	return m_TextureCubes[key].OnLoad();

}

bool fxcc::graph::common::TextureMaps::SetTextureCubeArray(const std::string& key, const std::string& realPath)
{
	auto& index = m_TextureCubeArrays[key].m_Index;
	index.m_TargetFilePath = realPath;
	return m_TextureCubeArrays[key].OnLoad();
}

bool fxcc::graph::common::TextureMaps::SetTexture3D(const std::string& key, const std::string& realPath)
{
	auto& index = m_Texture3Ds[key].m_Index;
	index.m_TargetFilePath = realPath;
	return m_Texture3Ds[key].OnLoad();
}



void fxcc::graph::common::TextureMaps::InitTexture2D(const std::string& key)
{
	m_Texture2Ds[key];
}

void fxcc::graph::common::TextureMaps::InitTexture2DArray(const std::string& key)
{
	m_Texture2DArrays[key];
}

void fxcc::graph::common::TextureMaps::InitTextureCube(const std::string& key)
{
	m_TextureCubes[key];
}

void fxcc::graph::common::TextureMaps::InitTextureCubeArray(const std::string& key)
{
	m_TextureCubeArrays[key];
}

void fxcc::graph::common::TextureMaps::InitTexture3D(const std::string& key)
{
	m_Texture3Ds[key];
}

